using System;
using System.Data;

using Wicresoft.Common;

namespace Wicresoft.Messages.Entity
{
    [Table("VErrorQueue", null, "Wicresoft.Messages.ConnectionString")]
    public class VErrorQueue : ViewInfo
    {
        #region SQL column name consts
        public const string SQLCOL_INFOID = "InfoID";
        public const string SQLCOL_INFOTYPE = "InfoType";
        public const string SQLCOL_CREATETIME = "CreateTime";
        public const string SQLCOL_ERRORMESSAGE = "ErrorMessage";
        public const string SQLCOL_STACKTRACE = "StackTrace";
        public const string SQLCOL_QUEUEID = "QueueID";
        public const string SQLCOL_MESSAGEID = "MessageID";
        public const string SQLCOL_MESSAGETEXT = "MessageText";
        public const string SQLCOL_MESSAGETITLE = "MessageTitle";
        public const string SQLCOL_DEVICEID = "DeviceID";
        public const string SQLCOL_QUEUESTATUS = "QueueStatus";
        public const string SQLCOL_LASTOPERATIONTIME = "LastOperationTime";
        public const string SQLCOL_SENDERNAME = "SenderName";
        public const string SQLCOL_SENDERDISPLAYNAME = "SenderDisplayName";
        public const string SQLCOL_RECEIVERNAME = "ReceiverName";
        public const string SQLCOL_RECEIVERDISPLAYNAME = "ReceiverDisplayName";
        public const string SQLCOL_RECEIVERCONTACT = "ReceiverContact";
        public const string SQLCOL_PROCESSSTATUS = "ProcessStatus";
        public const string SQLCOL_PROCESSTIME = "ProcessTime";
        public const string SQLCOL_PROCESSCOUNT = "ProcessCount";
        public const string SQLCOL_SENDTIME = "SendTime";
        public const string SQLCOL_GOTTIME = "GotTime";
        public const string SQLCOL_READTIME = "ReadTime";
        public const string SQLCOL_PRIORITY = "Priority";
        #endregion


        #region Contructors
        /// <summary>
        /// Construct empty entity
        /// </summary>
        public VErrorQueue() { }

        #endregion

        public override void Init(DataRow row)
        {
            InfoID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_INFOID]);
            InfoType = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_INFOTYPE]);
            CreateTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_CREATETIME]);
            ErrorMessage = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_ERRORMESSAGE]);
            StackTrace = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_STACKTRACE]);
            QueueID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_QUEUEID]);
            MessageID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_MESSAGEID]);
            MessageText = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_MESSAGETEXT]);
            MessageTitle = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_MESSAGETITLE]);
            DeviceID = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_DEVICEID]);
            QueueStatus = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_QUEUESTATUS]);
            LastOperationTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_LASTOPERATIONTIME]);
            SenderName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_SENDERNAME]);
            SenderDisplayName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_SENDERDISPLAYNAME]);
            ReceiverName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_RECEIVERNAME]);
            ReceiverDisplayName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_RECEIVERDISPLAYNAME]);
            ReceiverContact = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_RECEIVERCONTACT]);
            ProcessStatus = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_PROCESSSTATUS]);
            ProcessTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_PROCESSTIME]);
            ProcessCount = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_PROCESSCOUNT]);
            SendTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_SENDTIME]);
            GotTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_GOTTIME]);
            ReadTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_READTIME]);
            Priority = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_PRIORITY]);
        }

        #region Properties
        #region Property <Guid> InfoID
        [Property("InfoID", 16, SqlDbType.UniqueIdentifier, false, false)]
        public Guid InfoID
        {
            get { return _InfoID; }
            set { _InfoID = value; }
        }
        private Guid _InfoID = Guid.Empty;
        #endregion

        #region Property <int> InfoType
        [Property("InfoType", 4, SqlDbType.Int, false, false)]
        public int InfoType
        {
            get { return _InfoType; }
            set { _InfoType = value; }
        }
        private int _InfoType = int.MinValue;
        #endregion

        #region Property <DateTime> CreateTime
        [Property("CreateTime", 16, SqlDbType.DateTime, false, false)]
        public DateTime CreateTime
        {
            get { return _CreateTime; }
            set { _CreateTime = value; }
        }
        private DateTime _CreateTime = DateTime.MinValue;
        #endregion

        #region Property <string> ErrorMessage
        [Property("ErrorMessage", 2147483646, SqlDbType.NText, false, false)]
        public string ErrorMessage
        {
            get { return _ErrorMessage; }
            set { _ErrorMessage = value; }
        }
        private string _ErrorMessage = null;
        #endregion

        #region Property <string> StackTrace
        [Property("StackTrace", 2147483646, SqlDbType.NText, false, false)]
        public string StackTrace
        {
            get { return _StackTrace; }
            set { _StackTrace = value; }
        }
        private string _StackTrace = null;
        #endregion

        #region Property <Guid> QueueID
        [Property("QueueID", 16, SqlDbType.UniqueIdentifier, false, false)]
        public Guid QueueID
        {
            get { return _QueueID; }
            set { _QueueID = value; }
        }
        private Guid _QueueID = Guid.Empty;
        #endregion

        #region Property <Guid> MessageID
        [Property("MessageID", 16, SqlDbType.UniqueIdentifier, false, false)]
        public Guid MessageID
        {
            get { return _MessageID; }
            set { _MessageID = value; }
        }
        private Guid _MessageID = Guid.Empty;
        #endregion

        #region Property <string> MessageText
        [Property("MessageText", 2147483646, SqlDbType.NText, false, false)]
        public string MessageText
        {
            get { return _MessageText; }
            set { _MessageText = value; }
        }
        private string _MessageText = null;
        #endregion

        #region Property <string> MessageTitle
        [Property("MessageTitle", 2147483646, SqlDbType.NText, false, false)]
        public string MessageTitle
        {
            get { return _MessageTitle; }
            set { _MessageTitle = value; }
        }
        private string _MessageTitle = null;
        #endregion

        #region Property <int> DeviceID
        [Property("DeviceID", 4, SqlDbType.Int, false, false)]
        public int DeviceID
        {
            get { return _DeviceID; }
            set { _DeviceID = value; }
        }
        private int _DeviceID = int.MinValue;
        #endregion

        #region Property <int> QueueStatus
        [Property("QueueStatus", 4, SqlDbType.Int, false, false)]
        public int QueueStatus
        {
            get { return _QueueStatus; }
            set { _QueueStatus = value; }
        }
        private int _QueueStatus = int.MinValue;
        #endregion

        #region Property <DateTime> LastOperationTime
        [Property("LastOperationTime", 16, SqlDbType.DateTime, false, false)]
        public DateTime LastOperationTime
        {
            get { return _LastOperationTime; }
            set { _LastOperationTime = value; }
        }
        private DateTime _LastOperationTime = DateTime.MinValue;
        #endregion

        #region Property <string> SenderName
        [Property("SenderName", 100, SqlDbType.NVarChar, false, false)]
        public string SenderName
        {
            get { return _SenderName; }
            set { _SenderName = value; }
        }
        private string _SenderName = null;
        #endregion

        #region Property <string> SenderDisplayName
        [Property("SenderDisplayName", 100, SqlDbType.NVarChar, false, false)]
        public string SenderDisplayName
        {
            get { return _SenderDisplayName; }
            set { _SenderDisplayName = value; }
        }
        private string _SenderDisplayName = null;
        #endregion

        #region Property <string> ReceiverName
        [Property("ReceiverName", 100, SqlDbType.NVarChar, false, false)]
        public string ReceiverName
        {
            get { return _ReceiverName; }
            set { _ReceiverName = value; }
        }
        private string _ReceiverName = null;
        #endregion

        #region Property <string> ReceiverDisplayName
        [Property("ReceiverDisplayName", 100, SqlDbType.NVarChar, false, false)]
        public string ReceiverDisplayName
        {
            get { return _ReceiverDisplayName; }
            set { _ReceiverDisplayName = value; }
        }
        private string _ReceiverDisplayName = null;
        #endregion

        #region Property <string> ReceiverContact
        [Property("ReceiverContact", 200, SqlDbType.NVarChar, false, false)]
        public string ReceiverContact
        {
            get { return _ReceiverContact; }
            set { _ReceiverContact = value; }
        }
        private string _ReceiverContact = null;
        #endregion

        #region Property <int> ProcessStatus
        [Property("ProcessStatus", 4, SqlDbType.Int, false, false)]
        public int ProcessStatus
        {
            get { return _ProcessStatus; }
            set { _ProcessStatus = value; }
        }
        private int _ProcessStatus = int.MinValue;
        #endregion

        #region Property <DateTime> ProcessTime
        [Property("ProcessTime", 16, SqlDbType.DateTime, false, false)]
        public DateTime ProcessTime
        {
            get { return _ProcessTime; }
            set { _ProcessTime = value; }
        }
        private DateTime _ProcessTime = DateTime.MinValue;
        #endregion

        #region Property <int> ProcessCount
        [Property("ProcessCount", 4, SqlDbType.Int, false, false)]
        public int ProcessCount
        {
            get { return _ProcessCount; }
            set { _ProcessCount = value; }
        }
        private int _ProcessCount = int.MinValue;
        #endregion

        #region Property <DateTime> SendTime
        [Property("SendTime", 16, SqlDbType.DateTime, false, false)]
        public DateTime SendTime
        {
            get { return _SendTime; }
            set { _SendTime = value; }
        }
        private DateTime _SendTime = DateTime.MinValue;
        #endregion

        #region Property <DateTime> GotTime
        [Property("GotTime", 16, SqlDbType.DateTime, false, false)]
        public DateTime GotTime
        {
            get { return _GotTime; }
            set { _GotTime = value; }
        }
        private DateTime _GotTime = DateTime.MinValue;
        #endregion

        #region Property <DateTime> ReadTime
        [Property("ReadTime", 16, SqlDbType.DateTime, false, false)]
        public DateTime ReadTime
        {
            get { return _ReadTime; }
            set { _ReadTime = value; }
        }
        private DateTime _ReadTime = DateTime.MinValue;
        #endregion

        #region Property <int> Priority
        [Property("Priority", 4, SqlDbType.Int, false, false)]
        public int Priority
        {
            get { return _Priority; }
            set { _Priority = value; }
        }
        private int _Priority = int.MinValue;
        #endregion
        #endregion
    }
}